/**
 * 类目管理
 */
import request from '@/utils/request'

/**
 * @method categoryList
 * @description categoryId对应模板库
 */
export function categoryList(data) {
  return request({
    url: '/mall/admin/spec/list',
    method: 'post',
    data: data
  })
}

/**
 * @method categoryTree
 * @description category列表
 */
export function categoryTree() {
  return request({
    url: '/mall/admin/category/tree',
    method: 'get'
  })
}

/**
 * @method categoryDetail
 * @description category详情
 */
export function categoryDetail(params) {
  return request({
    url: '/mall/admin/category/detail',
    method: 'get',
    params: params
  })
}

/**
 * @method addCategory
 * @description 新增
 */
export function addCategory(data) {
  return request({
    url: '/mall/admin/category/add',
    method: 'post',
    data: data
  })
}

/**
 * @method updateCategory
 * @description 更新
 */
export function updateCategory(data) {
  return request({
    url: '/mall/admin/category/update',
    method: 'post',
    data: data
  })
}

/**
 * @method delCategory
 * @description 删除
 */
export function delCategory(params) {
  return request({
    url: '/mall/admin/category/delete',
    method: 'delete',
    params: params
  })
}

/**
 * @method getSpecId
 * @description 获取规则id
 */
export function getSpecId(params) {
  return request({
    url: '/mall/admin/spec/spec_id',
    method: 'get',
    params: params
  })
}

/**
 * @method getAttrId
 * @description 获取属性id
 */
export function getAttrId(params) {
  return request({
    url: '/mall/admin/spec/spec_attr_id',
    method: 'get',
    params: params
  })
}

/**
 * @method getAttrId
 * @description 类目参数列表
 */
export function paramList(data) {
  return request({
    url: '/mall/admin/category/param_list',
    method: 'post',
    data: data
  })
}
